package com.qf.controller;

import com.qf.pojo.User;
import com.qf.service.AdminService;
import com.qf.service.impl.AdminServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

/**
 * 查询用户列表
 */
@WebServlet("/findUserAll")
public class FindUserAllServlet extends HttpServlet {


    protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {


        //调用业务接口
        AdminService adminService = new AdminServiceImpl() ;
        List<User> list = adminService.getAllUser();

        //存储在request域中
        request.setAttribute("list",list);
        //请求转发到uset_list.jsp
        request.getRequestDispatcher("/admin/user_list.jsp").forward(request,response);

    }
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        doGet(request,response);

    }
}
